-- Copyright (C) 2013
--vss.workflow.upload is not OK

-------1定义公共组件(开始)---------------


local error_table = ngx.shared.gcs_error   --声明ngx.shared.gcs_error
local md5_check = ngx.shared.md5_check
local cjson       = require "cjson"
local  utils  = require "gcs.utils"
local ngx = ngx
-------1定义公共组件（结束）----------------
module(...)
local version = '0.1'


---------------------------------------------
----开始----

function get_version()
  return version
end
--------------

local function exit_err_log(model,err_code,err_no,vssid,err,exitcode)
  local tb_err = {}
  tb_err["code"] = err_code
  tb_err["vssid"] = vssid
  tb_err["message"] = err
  utils.gcs_log("error",model..",return error,err_code:"..err_code..",err_no:"..err_no..",err:"..cjson.encode(err))
  ngx.say(cjson.encode(tb_err))
  ngx.exit(exitcode)
end

function check_res(res,model,vssid,err,err_no,md5)
  if not res then
  if md5 then
    md5_check:delete(md5)
  end
  exit_err_log(model,206,err_no,vssid,err,444)
  end
  return res
end






